package com.VitalFit.mapper;

import com.VitalFit.model.entity.Customer;
import com.VitalFit.model.dto.RegisterCustomerDTO;
import com.VitalFit.model.vo.LoginCustomerVO;
import com.VitalFit.model.vo.RegisterCustomerVO;
import org.mapstruct.Context;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import org.springframework.security.crypto.password.PasswordEncoder;

@Mapper
public interface CustomerMapper {

    CustomerMapper INSTANCE = Mappers.getMapper(CustomerMapper.class);

    @Mapping(target = "password", expression = "java(passwordEncoder.encode(registerCustomerDTO.getPassword()))")
    Customer registerCustomerDTOToCustomer(RegisterCustomerDTO registerCustomerDTO, @Context PasswordEncoder passwordEncoder);

    RegisterCustomerVO customerToRegisterCustomerVO(Customer customer);

    LoginCustomerVO customerToLoginCustomerVO(Customer customer);



}